public class ThreadDemo {
    static class MyThread extends Thread{
        @Override
        public void run() {
            System.out.println(1);
        }
    }
    static class MyRunnable implements Runnable{
        @Override
        public void run() {
            System.out.println(2);
        }
    }
    public static void main(String[] args) {
        Thread t1 = new MyThread();
        Thread t2 = new Thread(new MyRunnable());
        Thread t3 = new Thread(){
            @Override
            public void run() {
                System.out.println(3);
            }
        };
        Thread t4 = new Thread(new Runnable() {
            @Override
            public void run() {
                System.out.println(4);
            }
        });
        Thread t5 = new Thread(()-> System.out.println(5));
        t1.start();
        t2.start();
        t3.start();
        t4.start();
        t5.start();
    }
}
